package com.hunk.springMvcExercise.aop;

import javax.servlet.http.HttpServletRequest;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class VisitCounterAspect {
	
	private static int COUNTER = 0;	
	private static final int COUNTER_LIMIT = 10;
	
	//@Before("execution(public * com.hunk.springMvcExercise.web.controller.UserConroller.index*(..))")
	@Before("execution(public * com.hunk.core.auth.controller.LoginConroller.index*(..)) && args(request,..)")
	public void before(HttpServletRequest request) {
	}	
	
	private synchronized void counterPlus() {
		COUNTER ++;
		if (COUNTER == COUNTER_LIMIT) { // 当100时存入数据库
			
		}
		COUNTER = 0;
	} 
}
